package com.eqdd.yiqidian.ui.gongneng.renshi.zuzhiguanli.zhizemiaosu;

import android.databinding.DataBindingUtil;

import com.eqdd.yiqidian.R;
import com.eqdd.yiqidian.base.BaseActivity;
import com.eqdd.yiqidian.AddGangweimiaoshuActivityCustom;
import com.eqdd.yiqidian.bean.EditBean;
import com.eqdd.yiqidian.ui.base.BaseMultiEditActivity;
import com.eqdd.yiqidian.ui.gongneng.kehu.AddJihuiActivity;

import android.support.v7.widget.RecyclerView;
import android.view.View;

import java.util.ArrayList;

public class AddGangweimiaoshuActivity extends BaseMultiEditActivity {
    private AddGangweimiaoshuActivityCustom dataBinding;
    private static final int NAME = 1;
    private static final int BUMEN = 2;
    private static final int GONGZUOXINGZHI = 3;
    private static final int XINZHIFANWEI = 4;
    private static final int GONGZUOMIAOSHU = 5;
    private static final int XUELI = 7;
    private static final int GONGZUOJINGYAN = 8;
    private static final int AGE = 9;
    private static final int SEX = 10;
    private static final int ZHUANGYEJINENG = 11;
    private static final int GANGWEILEIBIE = 12;
    private String[] titles = new String[]{
            "岗位信息",
            "岗位名称",
            "所属部门",
            "工作性质",
            "薪资范围",
            "工作描述",
            "岗位要求",
            "学历",
            "工作经验",
            "年龄",
            "性别",
            "专业技能",
            "岗位类别"
    };
    private String[] hintTexts = new String[]{
            "请输入",
            "请输入",
            "请输入",
            "请选择",
            "请选择",
            "请输入",
            "请输入",
            "请选择",
            "请输入",
            "请输入",
            "请选择",
            "请输入",
            "请选择"
    };
    private int[] types = new int[]{
            4, 4, 4, 2, 2, 0, 4, 2, 0, 0,
            1, 0, 4
    };

    @Override
    public void initBinding() {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_add_gangweimiaoshu);
        initTopTitleBar(View.VISIBLE, "岗位职责描述");
    }

    @Override
    public void initData() {
        String bumen = getIntent().getStringExtra("bumen");
        String gangwei = getIntent().getStringExtra("gangwei");

        initTopRightText("添加", v -> {
            startActivity(AddJihuiActivity.class);
        });
        for (int i = 0; i < titles.length; i++) {
            EditBean editBean = new EditBean();
            editBean.setTitle(titles[i]);
            editBean.setType(types[i]);
            editBean.setContent("");
            editBean.setTextTitle(titles[i]);
            editBean.setHint(hintTexts[i]);
            switch (i) {
                case 0:
                case 6:
                    editBean.setTopTitle(titles[i]);
                    editBean.setType(EditBean.TITLE);
                    break;
                case NAME:
                    editBean.setEnter(false);
                    editBean.setContent(gangwei);
                    break;
                case BUMEN:
                    editBean.setEnter(false);
                    editBean.setContent(bumen);
                    break;
                case SEX:
                    editBean.setChooseItem(new String[]{"男", "女", "不限"});
                    break;
            }
            editBeans.add(editBean);
        }
        if (quickAdapter != null) {
            ArrayList<EditBean> temp = new ArrayList<>();
            temp.addAll(editBeans);
            quickAdapter.notifyDataChanged(temp, true);
        }
    }

    @Override
    protected RecyclerView initRecyclerView() {
        return dataBinding.recyclerView;
    }

    @Override
    public void itemClick(int p) {

    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {

        }
    }
}
